home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 May: Tool Chest / Dev.CD May 97 TC.toast / Sample Code / Snippets / Development Tools & Languages / LockFile / SetLockBitAtomSample.r < prev   
Encoding:
Text File  |  1992-07-15  |  5.3 KB  |  159 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.2 sample: Action Atoms
  6.  *
  7.  *    File:        SetLockBitAtomSample.r -    Rez Source
  8.  *
  9.  *    by:            Rich Kubota
  10.  *
  11.  *    Copyright © 1992 Apple Computer, Inc.
  12.  *    All rights reserved.
  13.  *
  14.  *------------------------------------------------------------------------------
  15.  *
  16.  * Install application "TheProgram" into the "Root directory and lock the file.
  17.  * For this sample, I use TeachText as the program to install and lock.
  18.  * Demonstrates implementation of an action atom.
  19.  *----------------------------------------------------------------------------*/
  20. /*
  21.  
  22. You can build the script with the following lines:
  23.  
  24.         rez  -o "SetLockBitAtomSample" -t 'bjbc' -c 'bjbc' "SetLockBitAtomSample.r"
  25.         setfile -a i "SetLockBitAtomSample"
  26.         scriptcheck -p "SetLockBitAtomSample"
  27.  
  28. ------------------------------------------------------------------------------------------
  29. */
  30.  
  31. #include "Types.r"
  32. #include "InstallerTypes.r"
  33.  
  34. /* 'inaa' code resource definition */
  35. #define        aaCodeID            10000
  36.  
  37. /* put a 1 in the creation date field of source 'infs' to have ScriptCheck set date */
  38. #define kScriptCheckSetsDate    0x01
  39.  
  40. /* Definitions for the file spec atoms (specifications for source and destination files) */
  41. #define fsSourceProgram            2000
  42. #define fsTargetProgram            2001
  43.  
  44. /* This is the name of the source disk */
  45. #define ProgramDisk "Program Disk:"
  46.  
  47. /* where we want to install our file. */
  48. #define TargetPath    ":"
  49.  
  50. /* Definition for the package. */
  51. #define pkTheProgram            3000
  52.  
  53. /* Definition for the file atom */
  54. #define faProgram                4000
  55.  
  56. /* Definition for the package comment resource */
  57. #define cmtTheProgram            5000
  58.  
  59. /* Definitions for the action atom resources */
  60. #define aaSetLockBit            6000
  61.  
  62. /* June 16, 1992 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  63. /* this value to a LongInt seconds value needed by the Installer. */
  64. #define currentReleaseDate        6161992        
  65. #define currentVersion            100     /* Version 1.0 goes in the 'icmt' rsrc */
  66.  
  67. #define iconTheProgram            5100
  68.  
  69. /************************** Easy Install Rule resources **********************************/
  70.  
  71. /***************************** Package Resources ************************************************/
  72. resource 'inpk' (pkTheProgram) {
  73.     format0 {
  74.         ShowsOnCustom,                 /* Package appears in the Custom Install display */
  75.         Removable,                    /* Package can be removed */
  76.         dontForceRestart,            /* no need to restart */
  77.         cmtTheProgram,                 /* package's 'icmt' resource id */
  78.         0,                            /* Package size (filled in by ScriptCheck) */
  79.         "TheProgram", {                /* package name for package that shows on custom */
  80.             'infa', faProgram;
  81.             'inaa', aaSetLockBit;
  82.         }
  83.     }
  84. };
  85.  
  86. /***************************** Comments ************************************************/
  87. resource 'icmt' (cmtTheProgram) {
  88.     currentReleaseDate,
  89.     currentVersion,
  90.     iconTheProgram,
  91.     "This package contains TheProgram. "
  92. };
  93.  
  94. resource 'ICON' (iconTheProgram) {
  95.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  96.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  97.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  98.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  99.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  100.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  101.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  102.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  103. };
  104.  
  105.  
  106. /********************************************* File Specs ******************************************/
  107. /* Source File Specs */
  108. resource 'infs' (fsSourceProgram) {
  109.     'APPL',                                /* File Type */
  110.     'ttxt',                                /* Creator */
  111.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  112.     noSearchForFile,                    /* Do not search the source disk for the file */
  113.     TypeCrMustMatch,                    /* file type and creator on source disk must match */
  114.     ProgramDisk"TeachText"                /* Path to the file */
  115. };
  116.  
  117. /* Target File Specs */
  118. resource 'infs' (fsTargetProgram) {
  119.     'APPL',                                /* File Type */
  120.     'ttxt',                                /* Creator */
  121.     0,                                    /* creation date not needed for target file specs */
  122.     noSearchForFile,                    /* Do not search the target disk for the file */
  123.     TypeCrMustMatch,                    /* not needed for target file specs */
  124.     TargetPath"TeachText"                /* destination Path */
  125. };
  126.  
  127. /******************************************** File Atoms ************************************************/
  128. resource 'infa' (faProgram) {
  129.     format0 {
  130.         delRemove,                        /* Delete the file if remove (option-custom) is clicked    */
  131.         delInstall,                     /* Delete the target before copying new one */
  132.         copy,                             /* Copy the file to the destination */
  133.         leaveAloneIfNewer,                 /* do not Install this version, if newer one exists */
  134.         noKeepExisting,                 /* Always replace an existing copy */
  135.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  136.         rsrcFork, dataFork,                /* Copy both forks of the file */
  137.         fsTargetProgram,                /* TARGET file spec for this file */
  138.         fsSourceProgram,                 /* SOURCE file spec for this file */
  139.         0,                                /* atom size (filled in by ScriptCheck) */
  140.         ""                                /* Atom Description (Installer will use file name) */
  141.     };
  142. };
  143.  
  144.  
  145. resource 'inaa'    (aaSetLockBit) {
  146.     format0 {
  147.         actAfter,
  148.         dontActOnRemove,
  149.         actOnInstall,
  150.         'infn',
  151.         aaCodeID,
  152.         fsTargetProgram,                /* pass in the 'infs' resource ID of the file to lock */
  153.         "Set Locked Bit of Target file based on target infs resource ID"
  154.     }
  155. };
  156.  
  157. INCLUDE    "SetLockBit.rsrc" 'infn' (10000) AS 'infn' (aaCodeID, $$Attributes);
  158.  
  159.